import request from '@/utils/request'

export function totalAppointment(){
    return request({
        url: '/appointment/appointment/totalAppointment',
        method: 'get',
    })
}

/**
 * 咨询师初始化预约列表
 * @param counselorId
 * @returns {*}
 */
export function initAppointmentList(counselorId) {
    return request({
        url: `/appointment/appointment/initAppointmentList/${counselorId}`,
        method: 'get',
    })
}


export function getPatineList(query) {
    return request({
        url: '/appointment/appointment/getPatineList',
        method: 'get',
        params: query
    })
}

/**
 * 咨询师检查预约状态
 * @param patientId
 * @param counselorId
 * @returns {*}
 */
export function checkAppointmentStatus(patientId, counselorId) {
    return request({
        url: `/appointment/appointment/checkAppointmentStatus/${patientId}/${counselorId}`,
        method: 'get',
    })
}

/**
 * 咨询师结束咨询
 * @param patientId
 * @param counselorId
 * @returns {*}
 */
export function end(patientId, counselorId) {
    return request({
        url: `/appointment/appointment/end/${patientId}/${counselorId}`,
        method: 'put'
    })
}

/**
 * 处理预约申请
 * @param data
 * @returns {*}
 */
export function handleApprove(data) {
    return request({
        url: '/appointment/appointment/handleApprove',
        method: 'put',
        data: data
    })
}

// 查询咨询预约列表
export function listAppointment(query) {
    return request({
        url: '/appointment/appointment/adminGetList',
        method: 'get',
        params: query
    })
}

// 查询咨询预约详细
export function getAppointment(appointmentId) {
    return request({
        url: '/appointment/appointment/' + appointmentId,
        method: 'get'
    })
}

// 新增咨询预约
export function addAppointment(data) {
    return request({
        url: '/appointment/appointment',
        method: 'post',
        data: data
    })
}

// 修改咨询预约
export function updateAppointment(data) {
    return request({
        url: '/appointment/appointment',
        method: 'put',
        data: data
    })
}

// 删除咨询预约
export function delAppointment(appointmentId) {
    return request({
        url: '/appointment/appointment/' + appointmentId,
        method: 'delete'
    })
}
